package com.wwx.validator;

import com.wwx.validator.annotation.Gender;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

/**
 * GenderValidator
 *
 * @author 王伟欣
 * @version V1.0
 * @email w17731138318@126.com
 * @creator 2023-02-11 11:32
 * @company 晶品科技
 * @copyright 晶品科技 · 石家庄 · 技术二部
 */
public class GenderValidator implements ConstraintValidator<Gender,String> {

	private static final String MALE = "男";
	private static final String FEMALE = "女";
	@Override
	public void initialize(Gender constraintAnnotation) {
	}

	@Override
	public boolean isValid(String value, ConstraintValidatorContext context) {
		return MALE.equals(value) || FEMALE.equals(value);
	}
}
